<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>商品管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../component/elementUI/index.css">
    <link rel="stylesheet" href="../../../style/wangeditor.css">
    <link rel="stylesheet" href="../../../style/index.css">
    <style>
        .custom-tree-node {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 14px;
            padding-right: 8px;
        }

        .custom-tree-node .config {
            padding: 10px 0 10px 8px;
            /* border-left: 1px solid #EBEEF5; */
        }

        .el-tree-node__content {
            padding: 10px 0 10px;
            /* border-bottom: 1px solid #EBEEF5; */
        }

        .el-dialog__header {
            padding: 15px 15px 10px;
        }

        .el-dialog__body {
            padding: 15px;
        }

        .el-dialog__footer {
            padding: 5px 15px 10px;
        }

        .cont-scroll-wrap {
            border: 1px solid #EBEEF5;
            flex: auto;
            height: 0;
            overflow-y: auto;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="minWidth">
        <el-form :inline="true" :form="form">
            <el-form-item>
                <el-radio-group  @change="onSerach" v-model="form.selection">
                    <el-radio-button label="0">全部</el-radio-button>
                    <el-radio-button label="1">商品池</el-radio-button>
                    <el-radio-button label="2">自建</el-radio-button>
                </el-radio-group>
            </el-form-item>
            <el-form-item>
                <el-radio-group @change="onSerach" v-model="form.Row_Status">
                    <el-radio-button label="0">全部</el-radio-button>
                    <el-radio-button label="1">当前已选</el-radio-button>
                    <el-radio-button label="2">当前可选</el-radio-button>
                </el-radio-group>
            </el-form-item>
            <el-form-item>
                <el-input v-model.trim="form.Article_Name" clearable placeholder="请输入商品名称" />
            </el-form-item>
            <el-form-item>
                <el-select clearable v-model.trim="form.Brand_SerialNumber" placeholder="请选择商品品牌" filterable
                    style="width: 100%">
                    <el-option v-for="(item,index) in brand" :key="index" :label="item.Brand_Name"
                        :value="item.Brand_SerialNumber"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-cascader v-model="business_article_classify" clearable placeholder="请选择分类汇总" filterable collapse-tags
                    :props="defaultProps" :options="classify" style="width: 100%"></el-cascader>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSerach">查询</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="success" :loading="loading" @click="Export(form)">商品导出</el-button>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="Add">自建商品</el-button>
            </el-form-item>
            <!-- #9待完成的功能，暂时先不做 -->
            <!-- <el-form-item>
                <el-button type="primary" @click="handleBatchAdd">批量选品</el-button>
            </el-form-item> -->
            <el-form-item>
                <el-dropdown trigger="click" @command="downloadTemplate">
                    <el-button type="primary">
                        下载导入模板<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Article">商品模板</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item>
            <el-form-item>
                <el-dropdown trigger="click" @command="importTemplate">
                    <el-button type="danger">
                        批量导入<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Article">导入商品数据</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="examine">审核明细</el-button>
            </el-form-item>
            <!-- <el-form-item>
                <yl-button type="success" :data="ExportData" :loading="loading" @click="Export(form)">商品导出</yl-button>
            </el-form-item>
            <el-form-item>
                <el-dropdown trigger="click" @command="downloadTemplate">
                    <el-button type="primary">
                        导出模板<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Article">经营商品模板</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item>
            <el-form-item>
                <el-dropdown trigger="click" @command="importTemplate">
                    <el-button type="danger">
                        导入模板<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Article">导入供应商经营商品</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item> -->
            <!-- <el-form-item>
                <el-switch @change="onSerach" v-model="form.selection" active-text="已选" inactive-text=""></el-switch>
            </el-form-item> -->
        </el-form>
        <el-table v-if="table" ref="multipleTable" :data="tableData" stripe border height="calc(100vh - 210px)" style="width: 100%" :reserve-selection="true" :row-key="row=>row.Article_Specifications_SerialNumber" @selection-change="handleSelectionChange">
            <el-table-column fixed="left" align="center" type="selection" :reserve-selection="true" width="40"></el-table-column>
            <el-table-column fixed="left" align="center" type="index" label="序号" width="50"></el-table-column>
            <el-table-column fixed="left" align="center" prop="Article_SerialNumber" show-overflow-tooltip min-width="140" label="商品内码"></el-table-column>
            <el-table-column fixed="left" align="center" prop="Article_Code" show-overflow-tooltip min-width="140" label="商品编号"></el-table-column>
            <el-table-column fixed="left" align="center" prop="Picture_URL" width="140" align="center" label="商品封面">
                <template v-slot="{row}">
                    <el-image fit="contain" :src="BASE_IMG + row.Picture_URL"
                        style="width:100px;height: 100px;border-radius: 5px;"></el-image>
                </template>
            </el-table-column>
            <el-table-column fixed="left" align="center" prop="Article_Name" min-width="140" show-overflow-tooltip label="商品名称"></el-table-column>
            <el-table-column align="center" prop="Specifications_Name" min-width="140" show-overflow-tooltip label="规格名称"></el-table-column>
            <el-table-column align="center" prop="Brand_Name" min-width="100" show-overflow-tooltip label="品牌"></el-table-column>
            <el-table-column align="center" prop="Classify_Name" min-width="150" show-overflow-tooltip label="商品分类"></el-table-column>
            <el-table-column align="center" prop="JDCOM_Unit_Price" min-width="150" show-overflow-tooltip label="商品京东价"></el-table-column>
            <el-table-column align="center" prop="JDCOM_URL" min-width="150" show-overflow-tooltip label="商品京东链接"></el-table-column>
            <el-table-column align="center" prop="JDCOM_Unit_Price1" min-width="150" show-overflow-tooltip label="规格京东价"></el-table-column>
            <el-table-column align="center" prop="JDCOM_URL1" min-width="150" show-overflow-tooltip label="规格京东链接"></el-table-column>
            <el-table-column align="center" prop="Purchase_Unit_Price" min-width="180" show-overflow-tooltip label="一件代发价(元)">
                <template v-slot="{row}">
                    {{row.Row_Status=='0'||row.Row_Status1=='2'?row.Purchase_Unit_Price:''}}
                </template>
            </el-table-column>
            <el-table-column align="center" prop="Total_stock" min-width="100" show-overflow-tooltip label="每日供应">
                <template v-slot="{row}">
                    {{row.Row_Status=='0'||row.Row_Status1=='2'?row.Total_stock:''}}
                </template>
            </el-table-column>
            <!-- <el-table-column align="center" prop="Category_Name"  min-width="100" show-overflow-tooltip label="类别"></el-table-column>
            <el-table-column align="center" prop="Series_Name"  min-width="100" show-overflow-tooltip label="系列"></el-table-column>
            <el-table-column align="center" prop="Item_Name"  min-width="100" show-overflow-tooltip label="款型"></el-table-column> -->
            <el-table-column align="center" prop="Total_stock" min-width="100" show-overflow-tooltip label="商品来源">
                <template v-slot="{row}">
                    {{row.Other_SerialNumber==form.Supplier_SerialNumber?'自建':'商品池'}}
                </template>
            </el-table-column>
            <el-table-column align="center" label="状态" width="90">
                <template v-slot="{row}">
                    <!-- {{row.Row_Status2=='8'?'已拒绝(商品信息)':row.Row_Status1=='2'||row.Row_Status2=='9'?'审核中':row.Row_Status=='88'?'已拒绝':row.Row_Status=='0'?'已选品':'可选'}} -->
                    {{row.Row_Status1=='2'||row.Row_Status2=='9'?'审核中':row.Row_Status=='88'&&row.Other_SerialNumber==form.Supplier_SerialNumber?'已拒绝':row.Row_Status=='0'?'已选品':'可选'}}
                </template>
            </el-table-column>
            <el-table-column align="center" label="主数据修改" width="100">
                <template v-slot="{row}">
                    {{row.Row_Status2=='9'?'商品数据审核中':''}}
                </template>
            </el-table-column>
            <el-table-column fixed="right" align="center" label="操作" width="190">
                <template v-slot="{row}">
                    <!-- <el-button :type="row.Supplier_Article_SerialNumber?'danger':'success'" size="small" 
                        @click="select(row)">{{row.Supplier_Article_SerialNumber?'取消':'选品'}}</el-button> -->
                    <!-- <el-button @click="Edit(row.Article_SerialNumber)" v-if="row.Row_Status2=='8'" icon="el-icon-edit" size="small" type="warning">修改</el-button> -->
                    <el-button @click="Edit(row.Article_SerialNumber,'1',row.Article_Specifications_SerialNumber)" v-if="row.Row_Status=='88'&&!(row.Row_Status1=='2'||row.Row_Status2=='9')&&row.Other_SerialNumber==form.Supplier_SerialNumber" icon="el-icon-edit" size="small" type="warning">修改</el-button>
                    <el-button @click="Edit(row.Article_SerialNumber,'2',row.Article_Specifications_SerialNumber)" v-else-if="row.Row_Status=='88'&&row.Row_Status2=='8'&&row.Other_SerialNumber!=form.Supplier_SerialNumber" icon="el-icon-zoom-in" size="small" type="warning">详情</el-button>
                    <template v-else>
                        <el-button :type="row.Row_Status1=='2'||row.Row_Status2=='9'?'warning':row.Row_Status=='0'?'danger':'success'" size="small"
                        @click="select(row)">{{row.Row_Status1=='2'||row.Row_Status2=='9'?'审核中':row.Row_Status=='0'?'取消':'选品'}}</el-button>
                        <el-button @click="Edit(row.Article_SerialNumber,'1',row.Article_Specifications_SerialNumber)" v-if="row.Row_Status1!='2'&&row.Row_Status2!='9'&&row.Other_SerialNumber==form.Supplier_SerialNumber" icon="el-icon-edit" size="small" type="warning">修改</el-button>
                        <el-button @click="Edit(row.Article_SerialNumber,'2',row.Article_Specifications_SerialNumber)" v-else icon="el-icon-zoom-in" size="small" type="warning">详情</el-button>
                    </template>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination style="margin-top: 5px;" background @size-change="handleSizeChange"
            @current-change="handleCurrentChange" :current-page="form.page" :page-sizes="[10, 20, 30, 50]"
            :page-size="form.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
        <el-dialog title="采购信息" :visible.sync="dialogVisible" width="40%">
            <el-descriptions :column="2" border size="small">
                <el-descriptions-item label="采购单价">
                    <el-input clearable v-model.trim="form1.Purchase_Unit_Price" placeholder="请输入采购单价"></el-input>
                </el-descriptions-item>
                <el-descriptions-item label="每日供应">
                    <el-input clearable v-model.trim="form1.Quantity" placeholder="请输入每日供应"></el-input>
                </el-descriptions-item>
            </el-descriptions>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button :loading="loading" type="primary" @click="sumbit">确 定</el-button>
            </span>
        </el-dialog>
        <!-- <el-dialog title="批量选品" :visible.sync="dialogVisible1" width="40%">
            <el-descriptions :column="2" border size="small">
                <el-descriptions-item label="采购单价">
                    <el-input clearable v-model.trim="form1.Purchase_Unit_Price" placeholder="请输入采购单价"></el-input>
                </el-descriptions-item>
                <el-descriptions-item label="每日供应">
                    <el-input clearable v-model.trim="form1.Quantity" placeholder="请输入每日供应"></el-input>
                </el-descriptions-item>
            </el-descriptions>
            <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button :loading="loading" type="primary" @click="sumbit">确 定</el-button>
            </span>
        </el-dialog> -->
    </div>
    <script type="text/javascript" src="../../../utils/wangeditor.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.min.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../utils/vue.min.js"></script>
    <script type="text/javascript" src="../../../utils/vuex.min.js"></script>
    <script type="text/javascript" src="../../../component/elementUI/index.js"></script>
    <script type="text/javascript" src="../../../component/component.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.min.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.full.min.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.core.min.js"></script>
    <script type="text/javascript" src="../../../config/config.js"></script>
    <script type="text/javascript" src="../../../utils/compressor.js"></script>
    <script type="text/javascript" src="../../../utils/ID_Validity.js"></script>
    <script type="text/javascript" src="../../../utils/utils.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

</html>